from back_propagation import BackPropagation



if __name__ == '__main__':
    bp = BackPropagation()
    bp.read_parameters('weight/best')
    gard_1 = bp.grad_parameters_2(bp.train_images[5], bp.test_labels[5], bp.parameters)
    gard_2 = bp.grad_parameters(bp.train_images[5], bp.test_labels[5], bp.parameters)
    error = []
    for i in range(len(bp.dimensions)):
        if i:
            error_b = gard_1[i]['b'] - gard_2[i]['b']
            error_w = gard_1[i]['w'] - gard_2[i]['w']
            error.append({'b':error_b, 'w':error_w})

        else:
            error_b = gard_1[i]['b'] - gard_2[i]['b']
            error.append({'b':error_b})
    print(error)
